package com.note.simpleshop.module.goods.dao;
import com.note.simpleshop.entity.TbGoodsSpec;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
public interface GoodsSpecRepository extends JpaRepository<TbGoodsSpec, String>, JpaSpecificationExecutor<TbGoodsSpec> {
    List<TbGoodsSpec> findByGoodsId(String goodsId);
    @Transactional()
    @Modifying
    @Query("update TbGoodsSpec  set stock = ?1 where id=?2")
    void updateStock(Integer num,String id);
}
